package com.atguigu.controller;

import com.atguigu.client.OrderFeignClient;
import com.atguigu.client.ProductFeignClient;
import com.atguigu.client.SearchFeignClient;
import com.atguigu.entity.OrderInfo;
import com.atguigu.result.RetVal;
import com.atguigu.search.SearchParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class WebPayController {

    @Autowired
    OrderFeignClient orderFeignClient;
    //跳转到支付页面
    @GetMapping("pay.html")
    public String payment(@RequestParam Long orderId, HttpServletRequest request) {
        OrderInfo orderInfo = orderFeignClient.getOrderInfo(orderId);
        request.setAttribute("orderInfo", orderInfo);
        return "payment/pay";
    }


    //同步通知
    //支付成功之后通知
    //给用户展示支付成功页面
    @GetMapping("alipay/success.html")
    public String success(){
        return "payment/success";
    }


}
